package meta.api.web.account.businesscontrol;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import meta.api.web.account.business.UserMngService;
import meta.api.web.account.businessinfo.UserInfo;

@Transactional
@Component
public class UserMngBusiCtrl {

    @Autowired
    private UserMngService userMngService;

    @Transactional(readOnly = true)
    public boolean checkExistAccount(String account) {
        return userMngService.checkExistAccount(account);
    }

    @Transactional(rollbackFor = Exception.class)
    public void registerUser(UserInfo user) {
        userMngService.registerUser(user);
    }

    @Transactional(readOnly = true)
    public UserInfo getUser(String account, boolean pswdFlg) {
        return userMngService.getUser(account, pswdFlg);
    }

    @Transactional(readOnly = true)
    public boolean checkLogin(String account, String password) {
        return userMngService.checkLogin(account, password);
    }

    @Transactional(rollbackFor = Exception.class)
    public void updatePassword(String account, String password) {
        userMngService.updatePassword(account, password);
    }

    @Transactional(rollbackFor = Exception.class)
    public void updateEmail(UserInfo user) {
        userMngService.updateEmail(user);
    }
}
